package org.jeecg.modules.payment.enums;

import org.jeecg.common.annotation.EnumDict;
import org.jeecg.common.enums.IEnumDict;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.modules.payment.bo.IcBcPayChannel;
import org.jeecg.modules.payment.bo.WechatPayChannel;


@EnumDict(code ="pay_channel_enums", name = "支付渠道")
public enum PayChannelEnums implements IEnumDict<PayChannelEnums> {

    WECHAT_CHANNEL("WECHAT", "微信官方", "wechat", WechatPayChannel.class),

    ICBC_CHANNEL("ICBC", "工商银行", "icbc", IcBcPayChannel.class);

    private String value;

    private String label;
    /**
     * 不一定要有，为了前端vue渲染有个key
     */
    private String key;

    private Class clazz;

    PayChannelEnums(String value, String label, String key, Class clazz) {
        this.value = value;
        this.label = label;
        this.key = key;
        this.clazz = clazz;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String getLabel() {
        return label;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getRemark() {
        return null;
    }

    public Class getClazz() {
        return clazz;
    }

    public static PayChannelEnums getEnumByValue(String value){
        for(PayChannelEnums item: values()){
            if(value.equals(item.value)){
                return item;
            }
        }
        throw new JeecgBootException("没找到对应字典");
    }

}
